﻿@model IEnumerable<GameSchoolWeb.Models.Lecture>
<div id="templatemo_content">
    @{
        ViewBag.Title = "Fyrirlestrar";
    }
    <div class="templatemo_box">
        <h2>
            Fyrirlestrar</h2>
        <div class="body">
            @if (User.IsInRole("Kennari"))
            {
                <p>
                    @Html.ActionLink("Create New", "CreateLecture", "Video")
                </p>
            }
            <table>
                <tr>
                    <th>
                        Titill
                    </th>
                    <th>
                        Lýsing
                    </th>
                    <th>
                        Dagsetning
                    </th>
                    <th>
                        Level
                    </th>
                    <th>
                    </th>
                </tr>
                @foreach (var item in Model)
                {
                    <tr>
                        <td>
                            @Html.ActionLink(item.varTitle, "GetLecture", "Video", new { id = item.id }, null)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.strLectureDescription)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.dDateAdded)
                        </td>
                        <td>
                            @Html.DisplayFor(modelItem => item.levelId)
                        </td>
                        <td>
                            @if (User.IsInRole("Kennari"))
                            {
           
                                @Html.ActionLink("Eyða", "DeleteLecture", "Video", new { id = item.id }, new { onclick = "return confirm('Are you sure you want to delete this Lecture?');" })
                            }
                        </td>
                    </tr>
                }
            </table>
            <hr />
            <div>
                @Html.ActionLink("Aftur á forsíðu", "Index", "Home")
            </div>
        </div>
        <div class="box_bottom">
            <span></span>
        </div>
    </div>
</div>
